package cassandrawindow;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

public class PropertiesBase {
	
	protected Properties prop;
	private String fileprop;

	public PropertiesBase(String _fileprop){
		prop=new Properties();
		fileprop=_fileprop;
	}	
	
	public boolean loadFileProperties(){
		try {
	        FileInputStream fis = new FileInputStream(new File(fileprop));
	        prop.load(fis);    
	        fis.close();

		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
		return true;
	}
	
	public boolean storeFileProperties(){
		FileOutputStream fout=null;
		try {
			fout=new FileOutputStream(fileprop);
			prop.store(fout,"");
			fout.close();
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
		return true;
	}
}
